<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Introducing KitchenSync</title>
	<link rel="stylesheet" href="css/default.css" type="text/css" media="screen" charset="utf-8">	
</head>
<body>
<div id="main">

<h1 id="header">
<a href="http://code.google.com/p/kitchensynclib/"><img src="img/KSLogo.png" alt="KitchenSync v0.4" width="100%" /></a>
</h1>
<h3>Contents</h3>
<ul>
	<li><a href="#what">What is KitchenSync?</a></li>
	<li><a href="#goals">What are the goals of KitchenSync?</a></li>
	<li><a href="#how">How does it work?</a></li>
	<li><a href="#downloads">Download KitchenSync</a></li>
</ul>

<a name="what"></a>
<h2>What is KitchenSync?</h2>

<p>KitchenSync is an ActionScript 3.0 library for sequencing animations and other time-based <em>actions</em>.</p>

<h3>KitchenSync was designed with developers in mind</h3>

<p>KitchenSync was designed for developers who want a smart way to handle animation or other time-based functionality with code. Written from the ground up in ActionScript 3.0, KitchenSync relies on smart object-oriented architecture rather than complicated shorthand. It includes a number of features and shortcuts, such as the <code>clone()</code> method, that save effort for developers. KitchenSync makes extensive use of events and informative runtime errors and is quite flexible when it comes to extending the funcitonality.</p>

<p>The KitchenSync project is <a href="http://code.google.com/p/kitchensynclib/">hosted on Google Code.</a></p>

<h3>KitchenSync is more than an animation library</h3>

<p>Tweens are a major part of KitchenSync but that is not the end. It also allows you to sequence sounds, functions, and event dispatches among other actions. The framework is open-ended allowing you to come up with new ways to work with the virtual timeline.</p>

<a name="goals"></a>
<h2>What are the goals of KitchenSync?</h2>

<h3>KitchenSync aims to...</h3>
<ul>
<li>offer a well-architected, extensible framework for working with time-based animations and events.</li>
<li>take advantage of the power of ActionScript 3.0 while using OOP best practices and design patterns and without requiring the Flex framework.</li>
<li>respond to the needs of developers with a rich set of features.</li>
<li>be a full-featured library for animation and timeline based actions.</li>
</ul>

<a name="how"></a>
<h2>How does it work?</h2>
<p>KS uses an abstract class called <code>AbstractSynchronizedAction</code> as the base for all sequenceable events. These include (among other things) tweens, function calls, and event dispatches as well as groups of multiple actions. All synchronized actions share certain methods and properties such as <code>duration</code> and <code>start()</code> making them interchangeable and very easy to work with.</p>

<img src="img/synchronizedActionUML.png" alt="All action classes (including groups) inherit from the AbstractSynchronizedAction class." />
<p class="caption"><em>Fig 1</em> - Overview of the synchronized action inheritance. All action classes (including groups) inherit from the <code>AbstractSynchronizedAction</code> class.</p>

<h3>The Synchronizer</h3>
<p>Behind the scenes, a class called <code>Synchronizer</code> acts as a timing clock for all of the synchronized action. Each time an action starts, the Synchronizer adds it to a sort of <em>virtual timeline</em>.</p>

<img src="img/virtualTimeline.png" alt="Sequencer assigns actions to a 'virtual timeline'." />
<p class="caption"><em>Fig 2</em> - <code>Sequencer</code> assigns actions to a 'virtual timeline'.</p>

<p>Most synchronized actions have two properties that control time. They are <em>duration</em> and <em>offset</em>. The <code>duration</code> is the time during which the action executes. Some actions, such as functions and event dispatchers, have a duration of 0 meaning that they execute instantaneously and only once. The other property, <code>offset</code>, controls how much time will pass before the action will start to execute. Offset is synonymous with delay. Both properties start counting only after the action's <code>start()</code> method has been called.</p>

<h3>Commonly Used Actions</h3>

<h4>Tween</h4>
<p>Perhaps the most used action is the <code>Tween</code>. A tween is an object that represents a change of a property from one value to another over time. However, in most cases, the word tween is more likely to be synonymous with animation. A tween object has a target object (usually a display object) whose properties are affected, a target property, a duration, a start value and an end value. Tweens also use a special type of function, called an <em>easing function</em>, to determine the interpolation from the start to the ending values.</p>

<h4>SynchronizedFunction</h4>
<p>The <code>SynchronizedFunction</code> class represents a function or method and any specified arguments that are to be called at a specified time or after some delay. Just pass in the function you want to call and any arguments. The function will be called when the action executes.</p>
<p>Note that unlike earlier versions of ActionScript, with AS3 there is no need to use a delegate to retain the scope of the function.</p>

<h4>SynchronizedDispatchEvent</h4>
<p>An Event can be dispatched after a delay or as part of a sequence using a <code>SynchronizedDispatchEvent</code> object. Events are dispatched using the AS3 event dispatching system and can be sent from the <code>SynchronizedDispatchEvent</code> itself or from any other <code>IEventDispatcher</code>. The constructor can be passed either an <code>Event</code> object or a string for the event type.</p>

<h4>SynchronizedSound</h4>
<p>This class represents a sound that is to be played at a specified time or after some delay. The constructor will accept a <code>Sound</code> object, <code>URLRequest</code> object, or a URL as a string.</p>

<h3>The Action Groups</h3>
<p>The <code>AbstractSynchronizedActionGroup</code> class defines common characteristics of all action groups. All action groups use the <code>addAction()</code> method to add actions to the group. As you can see from Figure 1,  <code>AbstractSynchronizedActionGroup</code> is itself a subclass of <code>AbstractSynchronizedAction</code> allowing you to nest action groups within  other action groups or use a group as if it were a single action. This distinction makes creating long strings of time based events a relatively simple task.</p>

<img src="img/actionGroups.png" alt="Three types of Action Groups: Sequence, Parallel, and Staggered." />
<p class="caption"><em>Fig 3</em> - Three types of Action Groups: <code>Sequence</code>, <code>Parallel</code>, and <code>Staggered</code>.</p>

<h4>Sequence</h4>
<p>In a <code>Sequence</code> group, actions are executed one after the other in order. Delays in between individual actions within the group are still maintained and will begin counting when the action's turn in the sequence comes up.</p>

<h4>Parallel</h4>
<p>With <code>Parallel</code> groups, all actions within the group are executed simultaneously. Although they all start at the same time, they may end at different times.</p>

<h4>Staggered</h4>
<p>A Staggered group of actions will execute one after the other in a sequence however, the actions are separated by a specified time (e.g. 1 second) rather than the end of the previous action.</p>

<p>Groups can be used in conjunction with one another. For example, you may wish to create a sequence that contains a parallel action so that you can have several actions occur at the same point in a sequence.</p>
<p>With all of the action groups, separate events are dispatched upon completion of individual items and of the entire group.</p>


<a name="downloads"></a>
<h2>Downloads</h2>
<p>The KitchenSync project is <a href="http://code.google.com/p/kitchensynclib/">hosted on Google Code.</a></p>
</div><!-- END main -->
</body>
</html>